package sg.edu.nus.iss.vmcs.system;

/*
 * Copyright 2003 ISS.
 * The contents contained in this document may not be reproduced in any
 * form or by any means, without the written permission of ISS, other
 * than for the purpose for which it has been supplied.
 *
 */

import sg.edu.nus.iss.vmcs.store.*;

/**
 *
 *
 * @version 3.0 5/07/2003
 * @author Olivo Miotto, Pang Ping Li
 */

public class CashPropertyLoader extends PropertyLoader {

	public CashPropertyLoader() {
	}

	public void setImplementationType() {
		
		if(Environment.getImplementationType().equalsIgnoreCase("File"))		
				setPropertyLoaderImpl(new FilePropertyLoaderImpl(Environment.getCashPropFile())); // Environment.CASH_PROP_FILE
			
		else if(Environment.getImplementationType().equalsIgnoreCase("Xml"))
				setPropertyLoaderImpl(new XmlPropertyLoaderImpl(Environment.getCashPropXml()));// Environment.CASH_PROP_XML
		
	}
	
	public void saveProperty() throws Exception{
		getPropertyLoaderImpl().saveProperty();
	}
	
	public int getNumOfItems(){
		
		return getPropertyLoaderImpl().getNumOfItems();
	}
	
	public void setNumOfItems(int numItems){
		
		getPropertyLoaderImpl().setNumOfItems(numItems);
	}
	
	public StoreItem getItem (int index) {
		
		return getPropertyLoaderImpl().getItem(index);		
	}

	public void setItem(int index, StoreItem cashItem) {
		getPropertyLoaderImpl().setItem(index, cashItem);
	}
        
}